package com.chinaedu.oc.controller.commodity;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.chinaedu.oc.constant.Constant;
import com.chinaedu.oc.po.auditrecord.Auditrecord;
import com.chinaedu.oc.po.commodity.dto.CommodityListBaseDto;
import com.chinaedu.oc.serv.auditrecord.IAuditrecordServ;
import com.chinaedu.oc.util.common.JsonUtil;

/**
 * 审核记录
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/auditre/")
public class AuditreController {
	
	@Autowired
	private IAuditrecordServ iAuditrecordServ;
	
	/**
	 * 参数:commodityId   根据commodityId查询商品的审核信息
	 * @param data
	 * @return
	 */
	@RequestMapping("findAuditreInfo")
	public @ResponseBody CommodityListBaseDto<Auditrecord> findAuditreInfo(String data) {
		CommodityListBaseDto<Auditrecord> baseDto = new CommodityListBaseDto<Auditrecord>();
		Map map = JsonUtil.toBean(data, Map.class);
		String commodityId = (String)map.get("commodityId");
		try {
			baseDto.setData(iAuditrecordServ.findInfoByCommodityId(commodityId));
			baseDto.setStatus(Constant.TRUE);
		}catch (Exception e) {
			// TODO: handle exception
			baseDto.setMsg("查询失败");
			baseDto.setStatus(Constant.FALSE);
		}
		return baseDto;
	}
}

















